%option noyywrap nounput
%option bison-bridge reentrant

%{
#include <stdio.h>
#include "SmtpCommandsParser.h"
%}

%%
[ /t]	return SPACE;
\r\n	return CRLF;
:		return COLON;
\<		return LEFT_ANGLE_BRACKET;
>		return RIGHT_ANGLE_BRACKET;
@		return AT;
ehlo						yylval = strdup(yytext); printf("Flex: COMMAND_WITH_DOMAIN: %s; ", yytext); return COMMAND_WITH_DOMAIN;
mail[ ]from|rcpt[ ]to		yylval = strdup(yytext); printf("Flex: COMMAND_WITH_ADDRESS: %s; ", yytext); return COMMAND_WITH_ADDRESS;
data[ ]						yylval = strdup(yytext); printf("Flex: COMMAND_WITH_DATA: %s; ", yytext); return COMMAND_WITH_DATA;
noop|rset|quit				yylval = strdup(yytext); printf("Flex: CONTROL_COMMAND: %s; ", yytext); return CONTROL_COMMAND;
[A-Za-z0-9.-]+\.[A-Z]{2,6}	yylval = strdup(yytext); printf("DOMAIN: %s; ", yytext); return DOMAIN;
[A-Za-z0-9._%+-]+			yylval = strdup(yytext); printf("LOCAL_PART: %s; ", yytext); return LOCAL_PART;
%%